package skcontroller

import (
	"Cgo/common"
	"net/http"

	"github.com/gin-gonic/gin"
)

func SkTjController(r *gin.RouterGroup) {
	r.GET("/refreshBook", common.HandlerFunc(refreshRecommendedBooks))
}

func refreshRecommendedBooks(ctx *gin.Context) common.Result {
	data, err := TjDao.GetRecommendedBooks()
	if err != nil {
		ctx.JSON(http.StatusInternalServerError, common.R.Fail(err.Error()))
		return common.R.Fail(err.Error()) // 返回错误信息
	}

	ctx.JSON(http.StatusOK, common.R.Success(data))
	return common.R.Success(data) // 返回成功信息
}
